<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">

<title>module Agis - RDoc Documentation</title>

<script type="text/javascript">
  var rdoc_rel_prefix = "./";
</script>

<script src="./js/jquery.js"></script>
<script src="./js/darkfish.js"></script>

<link href="./css/fonts.css" rel="stylesheet">
<link href="./css/rdoc.css" rel="stylesheet">



<body id="top" role="document" class="module">
<nav role="navigation">
  <div id="project-navigation">
    <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2>
    <a href="./index.html" rel="home">Home</a>
  </h2>

  <div id="table-of-contents-navigation">
    <a href="./table_of_contents.html#pages">Pages</a>
    <a href="./table_of_contents.html#classes">Classes</a>
    <a href="./table_of_contents.html#methods">Methods</a>
  </div>
</div>

    <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

  </div>

  

  <div id="class-metadata">
    
    
    
    
    <!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    
    <li ><a href="#method-i-_agis_crunch">#_agis_crunch</a>
    
    <li ><a href="#method-i-_agis_find_global_mailboxes">#_agis_find_global_mailboxes</a>
    
    <li ><a href="#method-i-acall">#acall</a>
    
    <li ><a href="#method-i-agis_aconv">#agis_aconv</a>
    
    <li ><a href="#method-i-agis_boxlock">#agis_boxlock</a>
    
    <li ><a href="#method-i-agis_call">#agis_call</a>
    
    <li ><a href="#method-i-agis_chew">#agis_chew</a>
    
    <li ><a href="#method-i-agis_crunch_all_records">#agis_crunch_all_records</a>
    
    <li ><a href="#method-i-agis_crunch_all_records_new">#agis_crunch_all_records_new</a>
    
    <li ><a href="#method-i-agis_def">#agis_def</a>
    
    <li ><a href="#method-i-agis_defm0">#agis_defm0</a>
    
    <li ><a href="#method-i-agis_defm1">#agis_defm1</a>
    
    <li ><a href="#method-i-agis_defm2">#agis_defm2</a>
    
    <li ><a href="#method-i-agis_defm3">#agis_defm3</a>
    
    <li ><a href="#method-i-agis_fconv">#agis_fconv</a>
    
    <li ><a href="#method-i-agis_find_all_mailboxes">#agis_find_all_mailboxes</a>
    
    <li ><a href="#method-i-agis_id_prelim">#agis_id_prelim</a>
    
    <li ><a href="#method-i-agis_mailbox">#agis_mailbox</a>
    
    <li ><a href="#method-i-agis_method">#agis_method</a>
    
    <li ><a href="#method-i-agis_recall">#agis_recall</a>
    
    <li ><a href="#method-i-agis_returnbox">#agis_returnbox</a>
    
    <li ><a href="#method-i-agis_try_usig">#agis_try_usig</a>
    
    <li ><a href="#method-i-popfive">#popfive</a>
    
    <li ><a href="#method-i-pretty_exception">#pretty_exception</a>
    
  </ul>
</div>

  </div>
</nav>

<main role="main" aria-labelledby="module-Agis">
  <h1 id="module-Agis" class="module">
    module Agis
  </h1>

  <section class="description">
    
  </section>

  
  
  
  <section id="5Buntitled-5D" class="documentation-section">
    

    

    

    

    
     <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Instance Methods</h3>
       </header>

    
      <div id="method-i-_agis_crunch" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">_agis_crunch</span><span
            class="method-args">(redis, usig)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="_agis_crunch-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 230</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">_agis_crunch</span>(<span class="ruby-identifier">redis</span>, <span class="ruby-identifier">usig</span>)
  <span class="ruby-identifier">loop</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">lock</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_boxlock</span>, <span class="ruby-identifier">life</span><span class="ruby-operator">:</span> <span class="ruby-value">10</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lock</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">a</span> = <span class="ruby-identifier">agis_chew</span>(<span class="ruby-identifier">redis</span>, <span class="ruby-identifier">lock</span>)
      <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">lock</span>.<span class="ruby-identifier">stale_key?</span>
      <span class="ruby-identifier">u</span> = <span class="ruby-identifier">agis_try_usig</span>(<span class="ruby-identifier">redis</span>, <span class="ruby-identifier">usig</span>)
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">a</span> <span class="ruby-operator">==</span> <span class="ruby-value">:empty</span>
        <span class="ruby-identifier">raise</span> <span class="ruby-constant">Agis</span><span class="ruby-operator">::</span><span class="ruby-constant">MessageBoxEmpty</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">u</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">return</span> <span class="ruby-identifier">agis_fconv</span>(<span class="ruby-identifier">u</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">u</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-_agis_find_global_mailboxes" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">_agis_find_global_mailboxes</span><span
            class="method-args">(redis)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Find all mailboxes total</p>
          
          

          
          <div class="method-source-code" id="_agis_find_global_mailboxes-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 245</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">_agis_find_global_mailboxes</span>(<span class="ruby-identifier">redis</span>)
  <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">smembers</span>(<span class="ruby-string">&quot;AGIS_MAILBOX_GLOBAL_LIST&quot;</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-acall" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">acall</span><span
            class="method-args">(redis, name=nil, arg1=nil, arg2=nil, arg3=nil)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Alias for <a href="Agis.html#method-i-agis_call">#agis_call</a></p>
          
          

          
          <div class="method-source-code" id="acall-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 304</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">acall</span>(<span class="ruby-identifier">redis</span>, <span class="ruby-identifier">name</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">arg1</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">arg2</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">arg3</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">agis_call</span>(<span class="ruby-identifier">redis</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">arg1</span>, <span class="ruby-identifier">arg2</span>, <span class="ruby-identifier">arg3</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_aconv" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_aconv</span><span
            class="method-args">(v)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="agis_aconv-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 43</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_aconv</span>(<span class="ruby-identifier">v</span>)
  <span class="ruby-identifier">a</span> = <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">v</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">String</span>
    <span class="ruby-identifier">a</span> = <span class="ruby-string">&quot;s:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">v</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Symbol</span>
    <span class="ruby-identifier">a</span> = <span class="ruby-string">&quot;s:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Integer</span>
    <span class="ruby-identifier">a</span> = <span class="ruby-string">&quot;i:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Hash</span>
    <span class="ruby-identifier">a</span> = <span class="ruby-string">&quot;h:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_json</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Array</span>
    <span class="ruby-identifier">a</span> = <span class="ruby-string">&quot;a:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_json</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Float</span>
    <span class="ruby-identifier">a</span> = <span class="ruby-string">&quot;d:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">TrueClass</span>
    <span class="ruby-identifier">a</span> = <span class="ruby-string">&quot;t:&quot;</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">FalseClass</span>
    <span class="ruby-identifier">a</span> = <span class="ruby-string">&quot;f:&quot;</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">NilClass</span>
    <span class="ruby-identifier">a</span> = <span class="ruby-string">&quot;n:&quot;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">a</span> = <span class="ruby-string">&quot;h:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_json</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">a</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_boxlock" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_boxlock</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="agis_boxlock-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 142</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_boxlock</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_mailbox</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;.LOCK&quot;</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_call" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_call</span><span
            class="method-args">(redis, name=nil, arg1=nil, arg2=nil, arg3=nil)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Push a call and ncrunch immediately this returns the last return value from
the queue</p>
          
          

          
          <div class="method-source-code" id="agis_call-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 282</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_call</span>(<span class="ruby-identifier">redis</span>, <span class="ruby-identifier">name</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">arg1</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">arg2</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">arg3</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">name</span> <span class="ruby-operator">||=</span> <span class="ruby-string">&quot;AGIS_NOOP&quot;</span>
  <span class="ruby-identifier">until_sig</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Process</span>.<span class="ruby-identifier">pid</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Random</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">rand</span>(<span class="ruby-value">4000000000</span>).<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Random</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">rand</span>(<span class="ruby-value">4000000000</span>).<span class="ruby-identifier">to_s</span>
  <span class="ruby-identifier">loop</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">sadd</span>(<span class="ruby-string">&quot;AGIS_MAILBOX_CLASSES&quot;</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>)
      <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">sadd</span>(<span class="ruby-string">&quot;AGIS_MAILBOX_CLASS:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_id_prelim</span>)
      <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">sadd</span>(<span class="ruby-string">&quot;AGIS_MAILBOX_GLOBAL_LIST&quot;</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_mailbox</span>)
      <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">multi</span> <span class="ruby-keyword">do</span>
        <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">rpush</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_mailbox</span>, <span class="ruby-string">&quot;m:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>
        <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">rpush</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_mailbox</span>, <span class="ruby-identifier">agis_aconv</span>(<span class="ruby-identifier">arg1</span>)
        <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">rpush</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_mailbox</span>, <span class="ruby-identifier">agis_aconv</span>(<span class="ruby-identifier">arg2</span>)
        <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">rpush</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_mailbox</span>, <span class="ruby-identifier">agis_aconv</span>(<span class="ruby-identifier">arg3</span>)
        <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">rpush</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_mailbox</span>, <span class="ruby-string">&quot;r:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">until_sig</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">return</span> <span class="ruby-identifier">_agis_crunch</span>(<span class="ruby-identifier">redis</span>, <span class="ruby-identifier">until_sig</span>)
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Agis</span><span class="ruby-operator">::</span><span class="ruby-constant">MessageBoxEmpty</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_chew" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_chew</span><span
            class="method-args">(redis, lock)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="agis_chew-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 150</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_chew</span>(<span class="ruby-identifier">redis</span>, <span class="ruby-identifier">lock</span>)
  <span class="ruby-identifier">args</span> = <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">lrange</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_mailbox</span>, <span class="ruby-value">0</span>, <span class="ruby-value">4</span>)
  <span class="ruby-identifier">mni</span>  = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]
  <span class="ruby-keyword">if</span>(<span class="ruby-identifier">mni</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">mni</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-string">&quot;m:&quot;</span>)
    <span class="ruby-comment"># don&#39;t do any signatures twice ever</span>
    <span class="ruby-identifier">lusig</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">4</span>][<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
    <span class="ruby-comment">#puts lusig</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">hget</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_returnbox</span>, <span class="ruby-identifier">lusig</span>
      <span class="ruby-identifier">popfive</span> <span class="ruby-identifier">redis</span>
      <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">mn</span>        = <span class="ruby-identifier">mni</span>[<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
    <span class="ruby-identifier">mns</span>       = <span class="ruby-identifier">mn</span>.<span class="ruby-identifier">to_sym</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">mn</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;AGIS_NOOP&quot;</span> <span class="ruby-comment"># NOOP</span>
      <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">hset</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_returnbox</span>, <span class="ruby-identifier">lusig</span>, <span class="ruby-string">&quot;done&quot;</span>
      <span class="ruby-identifier">popfive</span>(<span class="ruby-identifier">redis</span>)
      <span class="ruby-keyword">return</span> <span class="ruby-value">:next</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">mc</span>        = <span class="ruby-ivar">@agis_methods</span>[<span class="ruby-identifier">mns</span>][<span class="ruby-value">:arity</span>]
      <span class="ruby-identifier">mrm</span>       = <span class="ruby-ivar">@agis_methods</span>[<span class="ruby-identifier">mns</span>][<span class="ruby-value">:mode</span>]
      <span class="ruby-identifier">meti</span>    = <span class="ruby-ivar">@agis_methods</span>[<span class="ruby-identifier">mns</span>][<span class="ruby-value">:method</span>]
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">meti</span>
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Proc</span>
        <span class="ruby-identifier">met</span> = <span class="ruby-identifier">meti</span>
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Symbol</span>
        <span class="ruby-identifier">met</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">meti</span>)
      <span class="ruby-keyword">when</span> <span class="ruby-constant">NilClass</span>
        <span class="ruby-identifier">met</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">mn</span>.<span class="ruby-identifier">to_sym</span>) <span class="ruby-comment"># when proc is Nil, call the class methods all the same</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    
    <span class="ruby-keyword">begin</span>
      <span class="ruby-comment">#raise Agis::RedisLockExpired if lock.stale_key?</span>
      <span class="ruby-comment">#begin</span>
      <span class="ruby-comment">#  lock.extend_life (@agis_methods[mn.to_sym][2] or 5)</span>
      <span class="ruby-comment">#rescue Redis::Lock::LockNotAcquired</span>
      <span class="ruby-comment">#  raise Agis::RedisLockExpired</span>
      <span class="ruby-comment">#end</span>
      <span class="ruby-identifier">popfive</span>(<span class="ruby-identifier">redis</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">mrm</span> <span class="ruby-operator">==</span> <span class="ruby-value">:once</span>
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">mc</span>
      <span class="ruby-keyword">when</span> <span class="ruby-value">0</span>
        <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">agis_aconv</span>(<span class="ruby-identifier">met</span>.<span class="ruby-identifier">call</span>())
      <span class="ruby-keyword">when</span> <span class="ruby-value">1</span>
        <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">agis_aconv</span>(<span class="ruby-identifier">met</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">agis_fconv</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>])))
      <span class="ruby-keyword">when</span> <span class="ruby-value">2</span>
        <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">agis_aconv</span>(<span class="ruby-identifier">met</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">agis_fconv</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>]), <span class="ruby-identifier">agis_fconv</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">2</span>])))
      <span class="ruby-keyword">when</span> <span class="ruby-value">3</span>
        <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">agis_aconv</span>(<span class="ruby-identifier">met</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">agis_fconv</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>]), <span class="ruby-identifier">agis_fconv</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">2</span>]), <span class="ruby-identifier">agis_fconv</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">3</span>])))
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">multi</span> <span class="ruby-keyword">do</span>
        <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">hset</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_returnbox</span>, <span class="ruby-identifier">lusig</span>, <span class="ruby-identifier">ret</span>
        <span class="ruby-identifier">popfive</span>(<span class="ruby-identifier">redis</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">mrm</span> <span class="ruby-operator">==</span> <span class="ruby-value">:retry</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">return</span> <span class="ruby-value">:next</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Agis</span><span class="ruby-operator">::</span><span class="ruby-constant">RedisLockExpired</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
      <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;Agis lock expired for &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword">if</span> (<span class="ruby-ivar">@agis_debugmode</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">true</span>)
      <span class="ruby-comment"># popfive redis</span>
      <span class="ruby-keyword">return</span> <span class="ruby-value">:relock</span>
    <span class="ruby-keyword">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
      <span class="ruby-comment">#puts &quot;feck&quot;</span>
      <span class="ruby-identifier">lock</span>.<span class="ruby-identifier">unlock</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">mni</span>
    <span class="ruby-keyword">return</span> <span class="ruby-value">:empty</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;AGIS error: Unrecognized line!&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">mni</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_crunch_all_records" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_crunch_all_records</span><span
            class="method-args">(redis)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Crunch all agis calls on a single model found using the find method with
the agis_id or id. Must be numeric</p>
          
          

          
          <div class="method-source-code" id="agis_crunch_all_records-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 257</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_crunch_all_records</span>(<span class="ruby-identifier">redis</span>)
  <span class="ruby-identifier">all</span> = <span class="ruby-identifier">agis_find_all_mailboxes</span>(<span class="ruby-identifier">redis</span>)
  <span class="ruby-identifier">all</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">id</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">id</span>).<span class="ruby-identifier">agis_call</span>(<span class="ruby-identifier">redis</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_crunch_all_records_new" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_crunch_all_records_new</span><span
            class="method-args">(redis)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Crunch all agis calls on a single model found using the new method with id
set to agis_id or id</p>
          
          

          
          <div class="method-source-code" id="agis_crunch_all_records_new-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 267</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_crunch_all_records_new</span>(<span class="ruby-identifier">redis</span>)
  <span class="ruby-identifier">all</span> = <span class="ruby-identifier">agis_find_all_mailboxes</span>(<span class="ruby-identifier">redis</span>)
  <span class="ruby-identifier">all</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">id</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">id</span>).<span class="ruby-identifier">agis_call</span>(<span class="ruby-identifier">redis</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_def" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_def</span><span
            class="method-args">(name, mode=:retry, timeout=nil, &b)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>alias for <a href="Agis.html#method-i-agis_defm3">#agis_defm3</a></p>
          
          

          
          <div class="method-source-code" id="agis_def-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 118</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_def</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-value">:retry</span>, <span class="ruby-identifier">timeout</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)
  <span class="ruby-identifier">agis_defm3</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">timeout</span>, <span class="ruby-identifier">b</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_defm0" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_defm0</span><span
            class="method-args">(name, mode=:retry, timeout=nil, &b)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>create a method with no parameters</p>
          
          

          
          <div class="method-source-code" id="agis_defm0-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 94</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_defm0</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-value">:retry</span>, <span class="ruby-identifier">timeout</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)
  <span class="ruby-ivar">@agis_methods</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@agis_methods</span>[<span class="ruby-identifier">name</span>] = {<span class="ruby-identifier">arity</span><span class="ruby-operator">:</span> <span class="ruby-value">0</span>, <span class="ruby-identifier">method</span><span class="ruby-operator">:</span> <span class="ruby-identifier">b</span>, <span class="ruby-identifier">mode</span><span class="ruby-operator">:</span> <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">timeout</span><span class="ruby-operator">:</span> <span class="ruby-identifier">timeout</span>}
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_defm1" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_defm1</span><span
            class="method-args">(name, mode=:retry, timeout=nil, &b)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>create a method with one parameter</p>
          
          

          
          <div class="method-source-code" id="agis_defm1-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 100</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_defm1</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-value">:retry</span>, <span class="ruby-identifier">timeout</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)
  <span class="ruby-ivar">@agis_methods</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@agis_methods</span>[<span class="ruby-identifier">name</span>] = {<span class="ruby-identifier">arity</span><span class="ruby-operator">:</span> <span class="ruby-value">1</span>, <span class="ruby-identifier">method</span><span class="ruby-operator">:</span> <span class="ruby-identifier">b</span>, <span class="ruby-identifier">mode</span><span class="ruby-operator">:</span> <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">timeout</span><span class="ruby-operator">:</span> <span class="ruby-identifier">timeout</span>}
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_defm2" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_defm2</span><span
            class="method-args">(name, mode=:retry, timeout=nil, &b)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>create a method with two parameters</p>
          
          

          
          <div class="method-source-code" id="agis_defm2-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 106</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_defm2</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-value">:retry</span>, <span class="ruby-identifier">timeout</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)
  <span class="ruby-ivar">@agis_methods</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@agis_methods</span>[<span class="ruby-identifier">name</span>] = {<span class="ruby-identifier">arity</span><span class="ruby-operator">:</span> <span class="ruby-value">2</span>, <span class="ruby-identifier">method</span><span class="ruby-operator">:</span> <span class="ruby-identifier">b</span>, <span class="ruby-identifier">mode</span><span class="ruby-operator">:</span> <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">timeout</span><span class="ruby-operator">:</span> <span class="ruby-identifier">timeout</span>}
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_defm3" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_defm3</span><span
            class="method-args">(name, mode=:retry, timeout=nil, &b)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>create a method with three parameters</p>
          
          

          
          <div class="method-source-code" id="agis_defm3-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 112</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_defm3</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-value">:retry</span>, <span class="ruby-identifier">timeout</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)
  <span class="ruby-ivar">@agis_methods</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@agis_methods</span>[<span class="ruby-identifier">name</span>] = {<span class="ruby-identifier">arity</span><span class="ruby-operator">:</span> <span class="ruby-value">3</span>, <span class="ruby-identifier">method</span><span class="ruby-operator">:</span> <span class="ruby-identifier">b</span>, <span class="ruby-identifier">mode</span><span class="ruby-operator">:</span> <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">timeout</span><span class="ruby-operator">:</span> <span class="ruby-identifier">timeout</span>}
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_fconv" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_fconv</span><span
            class="method-args">(v)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="agis_fconv-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 70</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_fconv</span>(<span class="ruby-identifier">v</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">v</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>]
  <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;s:&quot;</span>
    <span class="ruby-identifier">v</span>[<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
  <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;i:&quot;</span>
    <span class="ruby-identifier">v</span>[<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">to_i</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;h:&quot;</span>
    <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse!</span>(<span class="ruby-identifier">v</span>[<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>], <span class="ruby-identifier">symbolize_names</span><span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;a:&quot;</span>
    <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse!</span>(<span class="ruby-identifier">v</span>[<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>], <span class="ruby-identifier">symbolize_names</span><span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;d:&quot;</span>
    <span class="ruby-identifier">v</span>[<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">to_f</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;t:&quot;</span>
    <span class="ruby-keyword">true</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;f:&quot;</span>
    <span class="ruby-keyword">false</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;n:&quot;</span>
    <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;m:&quot;</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">MethodCallInParameters</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_find_all_mailboxes" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_find_all_mailboxes</span><span
            class="method-args">(redis)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Find all mailboxes for this class</p>
          
          

          
          <div class="method-source-code" id="agis_find_all_mailboxes-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 250</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_find_all_mailboxes</span>(<span class="ruby-identifier">redis</span>)
  <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">smembers</span>(<span class="ruby-string">&quot;AGIS_MAILBOX_CLASS:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_id_prelim" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_id_prelim</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="agis_id_prelim-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 23</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_id_prelim</span>
  <span class="ruby-keyword">begin</span>
    <span class="ruby-identifier">mid</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_id</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">NoMethodError</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">begin</span>
    <span class="ruby-identifier">mid</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">id</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">NoMethodError</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">mid</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_mailbox" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_mailbox</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>the name of the key used for the <a href="Agis.html">Agis</a> message box
in Redis the lock is this string followed by “.LOCK”</p>
          
          

          
          <div class="method-source-code" id="agis_mailbox-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 37</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_mailbox</span>
  <span class="ruby-identifier">mid</span> = <span class="ruby-identifier">agis_id_prelim</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoAgisIDAvailable</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">mid</span>
  <span class="ruby-identifier">a</span> = <span class="ruby-string">&quot;AGIS TERMINAL : &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot; : &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">mid</span>.<span class="ruby-identifier">to_s</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_method" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_method</span><span
            class="method-args">(name)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Get method in the format</p>
<dl class="rdoc-list label-list"><dt>arity, method body
<dd></dd></dl>
          
          

          
          <div class="method-source-code" id="agis_method-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 276</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_method</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-ivar">@agis_methods</span>[<span class="ruby-identifier">name</span>]
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_recall" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_recall</span><span
            class="method-args">(mn, arg1=nil, arg2=nil, arg3=nil)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Method for calling another <a href="Agis.html">Agis</a> method, or
retrying. this doesn&#39;t touch the message box because it should only be
called inside an <a href="Agis.html">Agis</a> method, where the box is
already guaranteed to be locked</p>
          
          

          
          <div class="method-source-code" id="agis_recall-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 312</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_recall</span>(<span class="ruby-identifier">mn</span>, <span class="ruby-identifier">arg1</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">arg2</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">arg3</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">meti</span> = <span class="ruby-ivar">@agis_methods</span>[<span class="ruby-identifier">mn</span>.<span class="ruby-identifier">to_sym</span>][<span class="ruby-value">:method</span>]
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">meti</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Proc</span>
    <span class="ruby-identifier">met</span> = <span class="ruby-identifier">meti</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Symbol</span>
    <span class="ruby-identifier">met</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">meti</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-constant">NilClass</span>
    <span class="ruby-identifier">met</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">mn</span>.<span class="ruby-identifier">to_sym</span>) <span class="ruby-comment"># when proc is Nil, call the class methods all the same</span>
  <span class="ruby-keyword">end</span>
  
  <span class="ruby-keyword">case</span> <span class="ruby-ivar">@agis_methods</span>[<span class="ruby-identifier">mn</span>.<span class="ruby-identifier">to_sym</span>][<span class="ruby-value">:arity</span>]
  <span class="ruby-keyword">when</span> <span class="ruby-value">0</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">met</span>.<span class="ruby-identifier">call</span>()
  <span class="ruby-keyword">when</span> <span class="ruby-value">1</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">met</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">arg1</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">2</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">met</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">arg1</span>, <span class="ruby-identifier">arg2</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">3</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">met</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">arg1</span>, <span class="ruby-identifier">arg2</span>, <span class="ruby-identifier">arg3</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_returnbox" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_returnbox</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="agis_returnbox-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 146</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_returnbox</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_mailbox</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;.RETN&quot;</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-agis_try_usig" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">agis_try_usig</span><span
            class="method-args">(redis, usig)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="agis_try_usig-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 220</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">agis_try_usig</span>(<span class="ruby-identifier">redis</span>, <span class="ruby-identifier">usig</span>)
  <span class="ruby-identifier">mayb</span> = <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">hget</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_returnbox</span>, <span class="ruby-identifier">usig</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">mayb</span>
    <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">hdel</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_returnbox</span>, <span class="ruby-identifier">usig</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">mayb</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-popfive" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">popfive</span><span
            class="method-args">(redis)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="popfive-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 132</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">popfive</span>(<span class="ruby-identifier">redis</span>)
  <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">multi</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">lpop</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_mailbox</span>
    <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">lpop</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_mailbox</span>
    <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">lpop</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_mailbox</span>
    <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">lpop</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_mailbox</span>
    <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">lpop</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">agis_mailbox</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-pretty_exception" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">pretty_exception</span><span
            class="method-args">(args, e)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="pretty_exception-source">
            <pre><span class="ruby-comment"># File lib/agis.rb, line 122</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">pretty_exception</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">e</span>)
  <span class="ruby-identifier">ret</span> = []
  <span class="ruby-identifier">ret</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;Agis method call failed: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-identifier">ret</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;  &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">ret</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">ret</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
  </section>
</main>


<footer id="validator-badges" role="contentinfo">
  <p><a href="http://validator.w3.org/check/referer">Validate</a>
  <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>

